﻿@{
    ViewBag.Title = "RoleBindModular";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
   <script type="text/javascript" language="javascript">
       $(document).ready(function () {
           var maiheight = document.documentElement.clientHeight;
           var mainWidth = document.documentElement.clientWidth - 3; // 减去边框和左边的宽度
           var gh = maiheight - 213;
           $("#modularid").height(gh);
           var option = {
               height: maiheight - 113,
               width: mainWidth,
               url: '@Url.Action("GetRoleList")', // 参数要放在）括号的外面
               dataType: 'json',
               colModel: [
					{ display: '角色编号', name: 'RoleId', width: 100, sortable: false, hide: false, align: 'left', iskey: true },
                    { display: '角色名称', name: 'RoleName', width: 200, sortable: false, hide: false, align: 'left' },
					{ display: '角色说明', name: 'RoleMeno', width: 200, sortable: false, hide: false, align: 'left' }
				],
               buttons: [
							{ name: 'Add', displayname: "绑定角色到模块", title: "绑定角色到模块", bclass: 'add', onpress: toolbarItemAdd_onclick },                            
							{ separator: true }
						 ],
               title: false,
               singleselected: true,
               usepager: true,
               resizable: true,
               page: 1, //默认当前页  
               total: 1, //总页面数  
               useRp: true, //是否可以动态设置每页显示的结果数  
               rp: 20, // 每页默认的结果数  
               rpOptions: [10, 15, 20], //可选择设定的每页结果数
               showcheckbox: true,
               selectedonclick: true,
               rowbinddata: true,
               hideOnSubmit: true, //隐藏提交  
               autoload: true
           };
           $("#allrolelist").flexigrid(option);

           function toolbarItemAdd_onclick(cmd, grid) {
               var items = $("#allrolelist").getSelectedRows();
               if (items.length == 0) {
                   showLoadingMsg("请选择要绑定的角色!", { left: 400, top: 6 }, true, 3000);
                   return false;
               }
               OpenModelWindow('@Url.Action("AddRoleToModular")?roleid=' + items[0][0],
                                   { width: 550, height: 440, caption: "角色绑定模块" });
           } // end of Add_onclick          
           function refreshGrid() {
               $("#allrolelist").flexReload();
           }
           function refresh() {
               showLoadingMsg("保存成功", { left: 200, top: 6 }, true, 3000);
               $("#allrolelist").flexReload();
           }
       });                             //end document ready() 
    </script>
}
<div id="container">
        <div id="title" class="title">角色列表</div>
        <table id="allrolelist" style="display: none;">
        </table>
    <input type="hidden" id="moId" />
    <input type="hidden" id="hdDicType" />
</div>



